package com.example.lirisheng.springbootfinalexperiment.repositories;

import com.example.lirisheng.springbootfinalexperiment.entity.Role;
import com.example.lirisheng.springbootfinalexperiment.entity.RoleAuthorities;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.Set;

public interface RoleAuthoritiesRepository extends CrudRepository<RoleAuthorities,Integer> {

    @Query(value = "select  name  from role JOIN role_authorities on role.id = role_authorities.role where  role_authorities.authority=?1   " ,
            nativeQuery = true)
    public Set<String> findRoleByAthorityId(Long id);
}
